<template>
	<view class="pb-safe-area bg-white p-16 fixed bottom-0 left-0 right-0 w-p-100 flex flex-column">
		<view class="btn-blue w-p-100 mb-10" @click="onClick"> 
			<slot></slot>
		</view>
		<view class="flex  gap-6 fs-14 flex-center mb-10" v-if="props.mode==false">
			<view class=" flex flex-center w-20 p-2 h-20 round-circle" :class="status?'border-blue':'border-87'"
				style="border-width: 2px;" @click="status=!status">
				<view class="w-p-100 h-p-100 round-circle bg-blue" v-if="status"></view>
			</view>
			<text>我已阅读并同意</text>
			<text class="text-blue" @click="$page.open('/pages/tags/index?key=agreement')">《使用协议》</text>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { $page } from '@/utils';
	const props = defineProps({
		text: {
			type: String,
			default: ''
		},
		mode: { //是否暂时协议
			default: false,
			type: Boolean
		}
	})
	const status = ref(false)
	const emit = defineEmits(['success'])

	const onClick = () => {
		if (props.mode == false && status.value==false) {
			uni.showToast({
				title: '请先阅读并同意《使用协议》',
				icon: 'none'
			})
			return;
		}
		emit('success')
	}
</script>

<style>

</style>